﻿using System.Collections.Generic;
using System.Xml.Serialization;

namespace HamcoWcs.Models.MesMessages
{

    public class MachineControlStateChangedDto : MachineMesBody
    {
        public MachineControlStateChangedDto()
        {

        }

        public MachineControlStateChangedDto(string machineName, string machineControlState, string user = "", string comment = "") : base(machineName, user, comment)
        {
            this.MachineControlState = machineControlState;
        }

        [XmlElement("MACHINECONTROLSTATE")]
        public string MachineControlState { get; set; }
    }

    public class MachineStateChangedDto : MachineMesBody
    {
        public MachineStateChangedDto()
        {

        }
        public MachineStateChangedDto(string machineName, string machineState, string user = "", string comment = "") : base(machineName, user, comment)
        {
            this.MachineState = machineState;
        }

        [XmlElement("MACHINESTATE")]
        public string MachineState { get; set; }
    }

    public class PortStateChangedDto : MachineMesBody
    {
        public PortStateChangedDto()
        {

        }
        public PortStateChangedDto(string machineName, string protName, string portState, string user = "", string comment = "") : base(machineName, user, comment)
        {
            this.PortName = protName;
            this.PortState = portState;
        }

        [XmlElement("PORTNAME")]
        public string PortName { get; set; }
        [XmlElement("PORTSTATE")]
        public string PortState { get; set; }
    }

    /// <summary>
    /// 切换Pallet的进出方向<br/>
    /// LINEOPERMODE=IN/OUT
    /// </summary>
    public class MachineModeChangeRequestDto : BaseMesBody
    {
        public MachineModeChangeRequestDto()
        {

        }
        public MachineModeChangeRequestDto(string lineName, string lineOperMode, string user = "", string comment = "") : base(user, comment)
        {
            this.LineName = lineName;
            this.LineOperMode = lineOperMode;
        }
        [XmlElement("LINENAME")]
        public string LineName { get; set; }
        [XmlElement("LINEOPERMODE")]
        public string LineOperMode { get; set; }
    }

    public class MachineModeChangeReplyDto : MachineModeChangeRequestDto
    {
        public MachineModeChangeReplyDto()
        {

        }
        public MachineModeChangeReplyDto(string lineName, string lineOperMode, string user = "", string comment = "") : base(lineName, lineOperMode, user, comment)
        {
        }
    }

    /// <summary>
    /// PALLETTYPE= FULL(有玻璃)/EMPTY（没玻璃）/PALLET（空栈板）
    /// </summary>
    public class ChangeMachinePalletTypeRequestDto : MachineMesBody
    {
        public ChangeMachinePalletTypeRequestDto()
        {

        }
        public ChangeMachinePalletTypeRequestDto(string machineName, string palletType, string user = "", string comment = "") : base(machineName, user, comment)
        {
            this.PalletType = palletType;
        }
        [XmlElement("PALLETTYPE")]
        public string PalletType { get; set; }
    }

    public class PalletAndBoxAssignRequestDto : MachineMesBody
    {
        public PalletAndBoxAssignRequestDto()
        {

        }
        public PalletAndBoxAssignRequestDto(string machineName, string portName, string palletName, string packingType, string boxQuantity, string user = "", string comment = "") : base(machineName, user, comment)
        {
            this.PortName = portName;
            this.PalletName = palletName;
            this.PackingType = packingType;
            this.BoxQuantity = boxQuantity;
        }
        [XmlElement("PORTNAME")]
        public string PortName { get; set; }
        [XmlElement("PALLETNAME")]
        public string PalletName { get; set; }
        [XmlElement("PACKINGTYPE")]
        public string PackingType { get; set; }
        [XmlElement("BOXQUANTITY")]
        public string BoxQuantity { get; set; }
        [XmlElement("BOXLIST")]
        public List<Box> BoxList { get; set; }
    }

    public class PalletAndBoxAssignReplyDto : PalletAndBoxAssignRequestDto
    {
        public PalletAndBoxAssignReplyDto()
        {

        }
        public PalletAndBoxAssignReplyDto(string machineName, string portName, string palletName, string packingType, string boxQuantity, string user = "", string comment = "") : base(machineName, portName, palletName, packingType, boxQuantity, user, comment)
        {
        }
    }

    public class ValidatePalletInputRequestDto : PalletMesBody
    {
        public ValidatePalletInputRequestDto()
        {

        }
        public ValidatePalletInputRequestDto(string machineName, string portName, string palletName, string user = "", string comment = "") : base(machineName, portName, palletName, user, comment)
        {
        }
    }

    public class ValidatePalletInputReplyDto : PalletMesBody
    {
        public ValidatePalletInputReplyDto()
        {

        }
        public ValidatePalletInputReplyDto(string machineName, string portName, string palletName, string user = "", string comment = "") : base(machineName, portName, palletName, user, comment)
        {
        }
    }

    public class ValidatePalletListRequestDto : PalletMesBody
    {
        public ValidatePalletListRequestDto()
        {

        }
        public ValidatePalletListRequestDto(string machineName, string portName, string palletName, string palletQty, string user = "", string comment = "") : base(machineName, portName, palletName, user, comment)
        {
            this.PalletQty = palletQty;
        }

        [XmlElement("PALLETQTY")]
        public string PalletQty { get; set; }
        [XmlElement("PALLETLIST")]
        public List<Pallet> PalletList { get; set; }
    }

    public class ValidatePalletListReplyDto : PalletMesBody
    {
        public ValidatePalletListReplyDto()
        {

        }
        public ValidatePalletListReplyDto(string machineName, string portName, string palletName, string palletQty, string user = "", string comment = "") : base(machineName, portName, palletName, user, comment)
        {
            this.PalletQty = palletQty;
        }

        [XmlElement("PALLETQTY")]
        public string PalletQty { get; set; }
        [XmlElement("PALLETLIST")]
        public List<Pallet> PalletList { get; set; }
    }

    public class PalletLocationChangedReportDto : PalletMesBody
    {
        public PalletLocationChangedReportDto()
        {

        }
        public PalletLocationChangedReportDto(string machineName, string portName, string palletName, string actionType, string user = "", string comment = "") : base(machineName, portName, palletName, user, comment)
        {
            this.ActionType = actionType;
        }

        [XmlElement("ACTIONTYPE")]
        public string ActionType { get; set; }
    }

    public class PortTransferStateChangedDto : BaseMesBody
    {
        public PortTransferStateChangedDto()
        {

        }
        public PortTransferStateChangedDto(string user = "", string comment = "") : base(user, comment)
        {
        }

        [XmlElement("LINENAME")]
        public string LineName { get; set; }
        [XmlElement("PORTLIST")]
        public List<Port> PortList { get; set; }
        [XmlElement("ULDPORTLIST ")]
        public object ULDPORTLIST { get; set; }
    }

    public class PalletRequestTransportJobRequestDto : BaseMesBody
    {
        [XmlElement("TRANSPORTJOBNAME")]
        public string TransportJobName { get; set; }
        [XmlElement("PALLETNAME")]
        public string PalletName { get; set; }
        [XmlElement("SOURCEMACHINENAME")]
        public string SourceMachineName { get; set; }
        [XmlElement("SOURCEPOSITIONTYPE")]
        public string SourcePositionType { get; set; }
        [XmlElement("SOURCEPOSITIONNAME")]
        public string SourcePositionName { get; set; }
        [XmlElement("SOURCEZONENAME")]
        public string SourceZoneName { get; set; }
        [XmlElement("DESTINATIONMACHINENAME")]
        public string DestinationMachineName { get; set; }
        [XmlElement("DESTINATIONPOSITIONTYPE")]
        public string DestinationPositionType { get; set; }
        [XmlElement("DESTINATIONPOSITIONNAME")]
        public string DestinationPositionName { get; set; }
        [XmlElement("DESTINATIONZONENAME")]
        public string DestinationZoneName { get; set; }
        [XmlElement("PRIORITY")]
        public string Priority { get; set; }
        [XmlElement("LANGUAGE")]
        public string Language { get; set; }

    }

    public class PalletRequestTransportJobReplyDto : PalletRequestTransportJobRequestDto
    {

    }

    public class PalletTransportJobStartedDto : BaseMesBody
    {
        [XmlElement("TRANSPORTJOBNAME")]
        public string TransportJobName { get; set; }
        [XmlElement("PALLETNAME")]
        public string PalletName { get; set; }
        [XmlElement("CURRENTMACHINENAME")]
        public string CurrentMachineName { get; set; }
        [XmlElement("CURRENTPOSITIONTYPE")]
        public string CurrentPositionType { get; set; }
        [XmlElement("CURRENTPOSITIONNAME")]
        public string CurrentPositionName { get; set; }
        [XmlElement("CURRENTZONENAME")]
        public string CurrentZoneName { get; set; }
        [XmlElement("TRANSFERSTATE")]
        public string TransferState { get; set; }
    }

    public class PalletLocationChangedDto : PalletTransportJobStartedDto
    {

    }

    public class PalletTransportJobCompletedDto : PalletTransportJobStartedDto
    {
        [XmlElement("REASONCODE")]
        public string ReasonCode { get; set; }
    }

    public class AreYouThereRequestDto : BaseMesBody
    {
        public AreYouThereRequestDto()
        {

        }

        public AreYouThereRequestDto(string lineName, string user = "", string comment = "") : base(user, comment)
        {
            LineName = lineName;
        }

        [XmlElement("LINENAME")]
        public string LineName { get; set; }
    }

    public class AreYouThereReplyDto : AreYouThereRequestDto
    {
        public AreYouThereReplyDto()
        {
        }

        public AreYouThereReplyDto(string lineName, string user = "", string comment = "") : base(lineName, user, comment)
        {
        }
    }

    public class InventoryPalletDataReportDto : MachineMesBody
    {
        public InventoryPalletDataReportDto()
        {

        }
        public InventoryPalletDataReportDto(string machineName = "", string user = "", string comment = "") : base(machineName, user, comment)
        {
        }

        [XmlElement("PALLETLIST")]
        public List<Pallet> PalletList { get; set; }

    }

    public class InventoryZoneDataReportDto : MachineMesBody
    {
        public InventoryZoneDataReportDto()
        {

        }

        public InventoryZoneDataReportDto(string machineName = "", string user = "", string comment = "") : base(machineName, user, comment)
        {
        }

        [XmlElement("ZONELIST")]
        public List<Zone> ZoneList { get; set; }
    }

    public class PalletTransportJobTerminatedByAGVDto : PalletTransportJobCompletedDto
    {

        public PalletTransportJobTerminatedByAGVDto()
        {
        }


    }


    public class PalletCancelTransportJobRequestDto : PalletRequestTransportJobRequestDto
    {

    }

    public class PalletCancelTransportJobReplyDto : PalletCancelTransportJobRequestDto
    {

    }

    public class ChangePalletDestinationRequestDto : BaseMesBody
    {
        [XmlElement("TRANSPORTJOBNAME")]
        public string TransportJobName { get; set; }
        [XmlElement("PALLETNAME")]
        public string PalletName { get; set; }
        [XmlElement("OLDDESTINATIONMACHINENAME")]
        public string OldDestinationMachineName { get; set; }
        [XmlElement("OLDDESTINATIONPOSITIONTYPE")]
        public string OldDestinationPositionType { get; set; }
        [XmlElement("OLDDESTINATIONPOSITIONNAME")]
        public string OldDestinationPositionName { get; set; }
        [XmlElement("OLDDESTINATIONZONENAME")]
        public string OldDestinationZoneName { get; set; }
        [XmlElement("NEWDESTINATIONMACHINENAME")]
        public string NewDestinationMachineName { get; set; }
        [XmlElement("NEWDESTINATIONPOSITIONTYPE")]
        public string NewDestinationPositionType { get; set; }
        [XmlElement("NEWDESTINATIONPOSITIONNAME")]
        public string NewDestinationPositionName { get; set; }
        [XmlElement("NEWDESTINATIONZONENAME")]
        public string NewDestinationZoneName { get; set; }
        [XmlElement("PRIORITY")]
        public string Priority { get; set; }
        [XmlElement("LANGUAGE")]
        public string Language { get; set; }
    }

    public class ChangePalletDestinationReplyDto : ChangePalletDestinationRequestDto
    {

    }


    public class PalletTransportPriorityChangedDto : JobMesBody
    {
        public PalletTransportPriorityChangedDto()
        {

        }
        public PalletTransportPriorityChangedDto(string jobName, string user = "", string comment = "") : base(jobName, user, comment)
        {
        }

        [XmlElement("PRIORITY")]
        public string Priority { get; set; }
    }
}
